package com.kstech.mp3604.manager

/**
 * author: blankii
 * created on: 2025/7/9 15:47
 * description:
 */
object CameraManager {
    private var state = false
    private var listener: CameraUIListener? = null
    fun setListener(listener: CameraUIListener) {
        this.listener = listener
    }

    fun openCamera() {
        //只有状态关闭的时候才能开启
        if (!state) {
            state = true

            listener?.openCameraFinished()
        }
    }

    fun closeCamera() {
        if (state) {
            state = false
            listener?.closeCameraFinished()
        }
    }


    fun clearListener() {
        listener = null
    }

    interface CameraUIListener {
        fun openCameraFinished()
        fun closeCameraFinished()
    }
}